/**
 * 企业排名
 */
import { defineComponent } from 'vue';
import { useRouter } from 'vue-router';
import WrapTitle from '@common/wrapTitle';
import './style.scss';

export default defineComponent({
  name: 'CompanyRank',
  props: {
    name: String,
    data: {
      type: Array,
      required: true,
      default: () => [],
    },
  },
  render(props) {
    const router = useRouter();
    return (
      <div id="CompanyRank">
        <WrapTitle title={props.name + '企业排名'}></WrapTitle>

        <ul>
          {props.data?.map?.((d: any, index: number) => {
            return (
              <li
                class={index % 2 ? '' : 'bg_another'}
                onClick={() => {
                  if (d.company_id) {
                    router.push({
                      path: `/industryView/company/${d.company_id}`,
                    });
                  }
                }}
              >
                <div>
                  <b> {index + 1}</b>
                </div>
                {d?.company_name}
              </li>
            );
          })}
        </ul>
      </div>
    );
  },
});
